<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="apple-mobile-web-app-capable" content="yes" />
		<meta name="apple-mobile-web-app-status-bar-style" content="black" />
		<meta name="format-detection" content="telephone=no, email=no" />
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="HandheldFriendly" content="true">
		<meta name="MobileOptimized" content="640">
		<meta name="screen-orientation" content="portrait">
		<meta name="x5-orientation" content="portrait">
		<meta name="full-screen" content="yes">
		<meta name="x5-fullscreen" content="true">
		<meta name="browsermode" content="application">
		<meta name="x5-page-mode" content="app">
		<meta name="msapplication-tap-highlight" content="no">
		<meta name="viewport" content="width=640,target-densitydpi=device-dpi,maximum-scale=1.0, user-scalable=no">

		<link rel="stylesheet" type="text/css" href="css/index.css" />
		<script>
			var phoneWidth = parseInt(window.screen.width);
			var phoneScale = phoneWidth / 640;
			var isAndroid = false;
			var ua = navigator.userAgent;
			if(/Android (\d+\.\d+)/.test(ua)) {
				var version = parseFloat(RegExp.$1);
				// andriod 2.3
				if(version > 2.3) {
					document.write('<meta name="viewport" content="width=640, minimum-scale = ' + phoneScale + ', maximum-scale = ' + phoneScale + ', target-densitydpi=device-dpi">');
					// andriod 2.3以上
				} else {
					document.write('<meta name="viewport" content="width=640, target-densitydpi=device-dpi">');
				}
				isAndroid = true;
				// 其他系统
			} else {
				document.write('<meta name="viewport" content="width=640, user-scalable=no, target-densitydpi=device-dpi">');
			}

			function GetQueryString(name) {
				var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
				var r = window.location.search.substr(1).match(reg);
				if(r != null) return unescape(r[2]);
				return null;
			}
		</script>
		<link rel="stylesheet" type="text/css" href="css/index.css" />
		<title>我就趴在你朋友圈，静静看你</title>
		<script>
			var _hmt = _hmt || [];
			(function() {
				var hm = document.createElement("script");
				hm.src = "//hm.baidu.com/hm.js?f13dfdd07d8f4e87d39277f25dfd7c4a";
				var s = document.getElementsByTagName("script")[0];
				s.parentNode.insertBefore(hm, s);
			})();
		</script>
	</head>

	<body>
		<div class="background">
			<div class="content_top">
				<img src="img/mid_bg1.jpg" id="one" />
				<input id="t1" placeholder="文字输入..." maxlength="5" />
			</div>
			<a href="javascript:;" class="button_font"><img src="img/font.png" /></a>
			<a href="javascript:;" class="button_expression"><img src="img/expression.png" /></a>
			<a href="javascript:;" class="button_save button_generate" id=""><img src="img/generate.png"/></a>
			<div class="content_bottom">
				<img src="img/mid_bottom.jpg" />
			</div>
			<a href="javascript:;" class="button_save"><img src="img/save.png" /></a>
		</div>

	</body>

	<script src="./js/jquery.min.js"></script>

	<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	<script src="http://api.weixin.yao.3xy.me/api/jsapi_js.php?id=8&debug=false"></script>
	<script>
		var baseUrl = "http://h5.idea.3xy.me/zqj2016/";
		var wxData = {

			imgUrl: baseUrl + "html/img/share.jpg",
			link: "http://h5.idea.3xy.me/zqj2016/html/index.html",
			desc: "卖萌发照骗秀恩爱剁手发鸡汤撩妹晒吃的加班出去浪",
			title: "我就趴在你朋友圈，静静看你",
			share: function() {
				//获取“分享到朋友圈”按钮点击状态及自定义分享内容接口
				wx.onMenuShareTimeline({
					title: wxData.desc,
					link: wxData.link,
					imgUrl: wxData.imgUrl,
					success: function() {
						// if(wxType == 1){
						//   shareSuccess()
						// }
					},
					cancel: function() {
						// 
					}
				});
				//获取“分享给朋友”按钮点击状态及自定义分享内容接口
				wx.onMenuShareAppMessage({
					title: wxData.title,
					desc: wxData.desc,
					link: wxData.link,
					imgUrl: wxData.imgUrl,
					type: '', // 分享类型,music、video或link，不填默认为link
					dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
					success: function() {
						// if(wxType == 1){
						//   shareSuccess()
						// }
					},
					cancel: function() {
						// 
					}
				});
			},
			callback: function() {}
		};

		wx.ready(function() {
			wxData.share()
		});

		//			var x = 20;
		//			var y = 0;
		//			var rand = parseInt(Math.random() * (x - y + 1) + y);
		var textinput = ['吃五仁', '秀恩爱', '发照骗', '出去浪', '晒吃的', '发票圈', '发鸡汤', '发广告', '卖面膜', '装 13', '加班', '约炮', '约饭', '撩妹', '撩汉', '吃土', '卖萌', '吐槽', '堵车', '剁手', ];
		$(".button_font").click(function() {
			var rand = parseInt(Math.random() * 20);
			$("input").val(textinput[rand]);
		})
		var imgId = 1;
		$(".button_expression").click(function() {
			imgId += 1;
			if(imgId > 10) {
				imgId = 1;
			}
			var path = 'img/mid_bg' + imgId + '.jpg';
			$('#one').attr('src', path);
		})
		
		
		$('.button_save').click(function() {
			if($("#t1").val() == "") {
				alert("请输入文字");
				return false;
			}
			var _txt1 = $('#t1').val();
			$.ajax({
				url: "../index.php?m=home&c=index&a=index",
				data: {
					'text': _txt1,
					'imgId': imgId,
				},
				type: 'post',
				success: function(ret) {
					if(ret.status) { //成功,输出图片路径
						//$('#mianimg').attr('src','.'+ret.path)
						window.location.href = './save.html?path=' + decodeURIComponent(ret.path);
						return false;
					} else {
						//失败
						alert(ret.info)
					}
				}
			})
		})
	</script>

</html>